//
//  GiftModel.m
//  GiftNote
//
//  Created by wsh on 15/8/13.
//  Copyright (c) 2015年 GN. All rights reserved.
//

#import "GiftModel.h"
#import "GiftSubcategoriesModel.h"

@implementation GiftModel
- (instancetype)init{
    if (self = [super init]) {
        _subcategories = [NSMutableArray arrayWithCapacity:0];
    }
    return self;
}


- (void)setValue:(id)value forKey:(NSString *)key{
    if ([key isEqualToString:@"id"]) {
        
        self.giftId = value;
    } else if ([key isEqualToString:@"subcategories"]){
        
        for (NSDictionary *dic in value) {
            GiftSubcategoriesModel *model = [[GiftSubcategoriesModel alloc] init];
            [model setValuesForKeysWithDictionary:dic];
            [self.subcategories addObject:model];
        }
        
    } else {
        
        [super setValue:value forKey:key];
    }

}




@end
